
import i18n from '@/locales/index'
const { t } = i18n.global

export const tabList = [
  {value: 1, label: t('other.staffCoefficient')},
  {value: 2, label: t('other.unCountDate')},
  {value: 3, label: t('other.monthCoefficient')},
  {value: 4, label: t('other.boardData')},
]
export const staffColumns =  [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { 
    title: t('sysManage.group'), dataIndex: 'groupName', key: 'groupName', align: 'center', width: 120,
    onFilter: (value, record) => record.groupName.includes(value) 
  },
  { title: t('basicData.jobNo'), dataIndex: 'staffNo', key: 'staffNo', align: 'center', width: 100  },
  { title: t('basicData.name'), dataIndex: 'nickName', key: 'nickName', align: 'center', width: 120 },
  { 
    title: t('other.coefficient'), dataIndex: 'percent', key: 'percent', align: 'center', width: 150, fixed: 'right',
    sorter: (a, b) => a.percent - b.percent,
  }
]

export const monthColumns =  [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('other.year'), dataIndex: 'recordYear', key: 'recordYear', align: 'center', width: 130  },
  { title: t('other.month'), dataIndex: 'recordMonth', key: 'recordMonth', align: 'center', width: 130  },
  { 
    title: t('other.coefficient'), dataIndex: 'percent', key: 'percent', align: 'center', width: 130, fixed: 'right',
    sorter: (a, b) => a.percent - b.percent
  }
]
export const kanbanRules = {
  reworkPercent: [{ required: true, message: t('other.pleaseInputReturnCoefficient') }, { pattern: /^\d+(\.\d{0,2})?$/, message: t('other.pleaseInputSureTypeKeepTwoPoint') }],
  defectPercent: [{ required: true, message: t('other.pleaseInputDefectCoefficient') }, { pattern: /^\d+(\.\d{0,2})?$/, message: t('other.pleaseInputSureTypeKeepTwoPoint') }],
  scrapPercent: [{ required: true, message: t('other.pleaseInputScrapCoefficient') }, { pattern: /^\d+(\.\d{0,2})?$/, message: t('other.pleaseInputSureTypeKeepTwoPoint') }]
}